#!/usr/bin/env python

class DieuWebBookmarks:
    def __init__(self, username, password, system):
        self.__dieu_username = username
        self.__dieu_password = password
        self.__dieu_system = system
        
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            dieu.delicious.login(self.__dieu_username, self.__dieu_password)
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            dieu.magnolia.login(self.__dieu_username, self.__dieu_password)
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            dieu.bluedot.login(self.__dieu_username, self.__dieu_password)
    
    def add_post(self, title, description, tags, posturl, shared):
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            dieu.delicious.add_post(title, description, tags, posturl, shared)
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            dieu.magnolia.add_post(title, description, tags, posturl, shared)
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            dieu.bluedot.add_post(title, description, tags, posturl, shared)
    
    def get_tags(self):
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            return dieu.delicious.get_tags()
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            return dieu.magnolia.get_tags()
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            return dieu.bluedot.get_tags()
    
    def get_posts(self):
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            return dieu.delicious.get_posts()
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            return dieu.magnolia.get_posts()
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            return dieu.bluedot.get_posts()
    
    def get_stats(self):
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            return dieu.delicious.get_stats()
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            return dieu.magnolia.get_stats()
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            return dieu.bluedot.get_stats()
    
    def check_status(self):
        if self.__dieu_system == 'del.icio.us':
            import dieu.delicious
            return dieu.delicious.check_status()
        elif self.__dieu_system == 'ma.gnolia':
            import dieu.magnolia
            return dieu.magnolia.check_status()
        elif self.__dieu_system == 'bluedot':
            import dieu.bluedot
            return dieu.bluedot.check_status()
